package com.example.designer.flyweight;


import org.openjdk.jol.info.ClassLayout;

/**
 * @author zhaoyunlong
 * @date 2020/12/24
 * @description
 */
public class TestString {
    public static void main(String[] args) {

//        String s1 = "abc";
//        String s2 = "abc";
//        String s3 = new String("abc");
//        String s4 = new String("abc");
//
//        System.out.println(s1 == s2);
//        System.out.println(s1 == s3);
//        System.out.println(s3 == s4);
//        System.out.println(s1 == s3.intern());
//        System.out.println(s4.intern() == s3.intern());
        Object o = new Object();
        // 打印出A对象的内存空间大小
        String printable = ClassLayout.parseInstance(o).toPrintable();
        StringBuffer stringBuffer = new StringBuffer();
        System.out.println(printable);
    }
}
